#ifndef FORM_YS_sfgl_H
#define FORM_YS_sfgl_H

#include "pub_pop_get_date.h"
#include "pub_pop_delay.h"
#include "pub_pop_get_value.h"
#include "pub_sqthread.h"


#include <QWidget>
#include <QNetworkAccessManager>
#include <QNetworkReply>
#include <QNetworkInterface>
#include <QNetworkRequest>
#include <QJsonObject>
#include <QJsonArray>
#include <QSqlQuery>
#include <QMap>
#include <QSqlQueryModel>
#include <QStandardItemModel>
#include <QComboBox>
#include <QTimer>

namespace Ui {
class Form_ys_sfgl;
}

class Form_ys_sfgl : public QWidget
{
    Q_OBJECT

public:
    explicit Form_ys_sfgl(QWidget *parent = nullptr);
    ~Form_ys_sfgl();

    void closeEvent(QCloseEvent *event);

signals:
    void destroyW( QString );
    void trigTimer();

private slots:

    bool statusCheck(int); //环境合理性校验 0病志， 1处方
    void threadMsg(QString s);

    void fillCombo(QComboBox *cbb, QString sq , int ind);

    void localHistory(QString bzh);

    void on_pbExit_clicked();

    void on_pbFresh_clicked();

    void on_tvList_clicked(const QModelIndex &index);

    void on_tvHistory_clicked(const QModelIndex &index);

    void on_tvHistory_doubleClicked(const QModelIndex &index);

    void on_pb_call_save_clicked();

    void on_tb_reg_0_clicked();

    void on_tb_reg_1_clicked();

    void on_le_name_s_textChanged(const QString &arg1);

    void on_le_wx_name_s_textChanged(const QString &arg1);

private:
    Ui::Form_ys_sfgl *ui;

    QSqlQuery *qrm, *qrmt, *qro, *qrot;
    //QSqlQueryModel mdList ;//

    bool initialFinished;//界面初始化完成标志

    QString sq;
    QString cur_item_code;  //当前正在编辑的项目代码
    QString ybysdm; //医保医师代码

    QSqlQueryModel *md, *mdHist, *mdRecipe, *mdRecipeNew, *mdGroupPop, *mdSearchPop;
    QStandardItemModel *mdRelated, *mdGroup;

    QNetworkRequest request;
    QNetworkAccessManager manager ;
    QMap<QString,QString> mpPatientInfo;
    QMap<QString,QString> mpRecipeItemInfo; //手工录入处方，存储中间值
    QString zd1c,zd2c,zd3c,jzyyc;   //诊断代码，就诊原因代码

    Pub_pop_delay * dlgDelay;
    Pub_pop_get_value * dlgGetValue;
    pub_pop_get_date * dlg_get_date;
    sqThread * sqlThread;
    QStringList sqlMsg;


};

#endif // Form_ys_sfgl_H
